#include <iostream>
#include <exception>

using std::cout;
using std::endl;

void exception()
{
    cout << "exception() before exception...\n";
    throw std::bad_alloc();  
    cout << "exception() after exception...\n";
}

void test() 
{
    cout << "test() before exception...\n";
    exception();
    cout << "test() after exception...\n";
}

int main(int args, char *argv[])
{
    
    cout << "main() before exception...\n";
    try{
        test();
    }catch(const std::exception& e){
        e.what();
        cout << "main() after exception...\n";
    }
    return 0;
}